var article = {
	init: function() {
		article.updateForm = $("#updateForm");
	},
	operate: {
		updateArticle: function(obj) {
			var allInput = article.updateForm.find("input");
			var allTd = $(obj).parent().parent().find("td");
			$(allInput[0]).val($(allTd[1]).find("input").val());
			for(var i = 1; i < allInput.length ; i ++) {
				$(allInput[i]).val(allTd[i+1].innerHTML);
			}
		},
		deleteArticle: function(obj) {
			var parent = $(obj).parent().parent();
			var id = parent.find("input").val();
			$.post(ctx + "/article/delete/" + id + ".html", function(data) {
				if(data.result == "success") {
					parent.remove();
				}
			});
		}
	}
}
$(function() {
	article.init();
});